const { createRouter, createWebHistory } = VueRouter;
import Home from '../views/Home.vue';
import About from '../views/About.vue';

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    meta: { requiresAuth: false } // 可选：路由元信息
  },
  {
    path: '/about',
    name: 'About',
    component: About,
    meta: { requiresAuth: true }
  }
];

const router = createRouter({
  history: createWebHistory(), // 使用 HTML5 History 模式
  routes,
  scrollBehavior(to, from, savedPosition) {
    // 滚动行为控制（可选）
    return savedPosition || { top: 0 };
  }
});

export default router;